﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EasyOAuth.Core.Web
{
    /// <summary>
    /// api 结果错误
    /// </summary>
    public class ApiResException : ApplicationException
    {

        /// <summary>
        /// 状态吗
        /// </summary>
        public int Code { get; set; } = 0;

        /// <summary>
        /// 数据结果
        /// </summary>
        public object DataResult { get; set; } = new object();

        /// <summary>
        /// 抛错
        /// </summary>
        /// <param name="message">错误信息</param>
        /// <param name="code">错误码</param>
        /// <param name="data">数据结果 抛错可能是 对象 或者数组 或者其它</param>
        public ApiResException(string message, int code, object data) : base(message)
        {
            this.Code = code;
            this.DataResult = data;
        }
    }

}
